package cn.xxi.ai.config;


import io.milvus.client.MilvusServiceClient;
import io.milvus.param.ConnectParam;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MilvusConfigurer {

    @Bean
    public MilvusServiceClient milvusClient(MilvusProperties properties) {
        ConnectParam connectParam = ConnectParam.newBuilder()
                .withHost(properties.getHost())
                .withPort(Integer.parseInt(properties.getPort()))
                // .withAuthorization(properties.getUsername(), properties.getPassword())
                .withDatabaseName(properties.getDatabaseName())
                .build();

        return new MilvusServiceClient(connectParam);
    }
}